﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <%@include file="common/head.jsp" %>
</head>

<body>
<div id="wrapper">

    <%@include file="common/sidebar.jsp" %>

    <div id="page-wrapper">
        <div id="page-inner">
            <div class="row">
                <div class="col-md-12">
                    <h1 class="page-header">
                        更新商家
                        <small>update business.</small>
                    </h1>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            更新商家表单
                        </div>
                        <div class="panel-body">
                            <form id="updateBusinessForm">
                                <div class="row">
                                    <div class="col-lg-6">
                                        <div class="form-group hide">
                                            <label>ID</label>
                                            <input class="form-control" name="bnId" value="${businessVo.business.bnId}">
                                        </div>
                                        <div class="form-group">
                                            <label>认证人</label>
                                            <input class="form-control" name="bnAuthorName" value="${businessVo.bnAuthorName}" readonly>
                                        </div>
                                        <div class="form-group">
                                            <label>商家名称</label>
                                            <input class="form-control bnName" name="bnName" value="${businessVo.business.bnName}">
                                        </div>
                                        <div class="form-group">
                                            <label>联系电话</label>
                                            <input class="form-control" name="bnPhone" value="${businessVo.business.bnPhone}">
                                        </div>
                                        <div class="form-group">
                                            <label>认证状态</label>
                                            <label class="radio-inline">
                                                <input type="radio" name="bnAuthorState" class="bnAuthorState" value="0"
                                                       checked=""> 审核通过
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="bnAuthorState" class="bnAuthorState" value="1"> 审核中
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="bnAuthorState" class="bnAuthorState" value="2"> 未审核
                                            </label>
                                        </div>
                                        <div class="form-group">
                                            <label>商家地址</label>
                                            <input class="form-control" name="bnAddress" value="${businessVo.business.bnAddress}">
                                        </div>
                                        <div class="form-group">
                                            <label>法人代表</label>
                                            <input class="form-control" name="bnLegalPerson" value="${businessVo.business.bnLegalPerson}">
                                        </div>
                                        <div class="form-group">
                                            <label>注册资本</label>
                                            <input class="form-control" name="bnRegCapital" value="${businessVo.business.bnRegCapital}">
                                        </div>
                                        <div class="form-group">
                                            <label>注册时间</label>
                                            <input class="form-control" value="${fn:substring(businessVo.business.bnRegDate, 0, 10)}">
                                        </div>
                                        <div class="form-group">
                                            <label>注册地址</label>
                                            <input class="form-control"name="bnRegAddress" value="${businessVo.business.bnRegAddress}">
                                        </div>
                                        <div class="form-group">
                                            <label>营业期限</label>
                                            <input class="form-control" name="bnTerm" value="${businessVo.business.bnTerm}">
                                        </div>
                                        <div class="form-group">
                                            <label>统一代码号</label>
                                            <input class="form-control" name="bnCode" value="${businessVo.business.bnCode}">
                                        </div>
                                        <div class="form-group">
                                            <label>经营类型</label>
                                            <input class="form-control" name="bnType" value="${businessVo.business.bnType}">
                                        </div>
                                        <div class="form-group">
                                            <label>经营范围</label>
                                            <textarea class="form-control" name="bnRange" rows="6">${businessVo.business.bnRange}</textarea>
                                        </div>
                                        <div class="form-group">
                                            <label>实际经营范围</label>
                                            <textarea class="form-control" name="bnActualRange" rows="6">${businessVo.business.bnActualRange}</textarea>
                                        </div>

                                    </div>
                                    <div class="col-lg-6">

                                        <div class="form-group">
                                            <label>主图</label>
                                            <input type="file" class="bnMainPictureFile">
                                            <input type="hidden" name="bnMainPicture" class="bnMainPicture">
                                            <img class="img-rounded img-responsive bnMainPictureImg" alt="未上传" style="max-height: 300px;"  src="${businessVo.business.bnMainPicture}">
                                        </div>
                                        <div class="form-group">
                                            <label>展示图</label>
                                            <input type="file" class="bnExhibitionPictureFile">
                                            <input type="hidden" name="bnExhibitionPicture" class="bnExhibitionPicture">
                                            <img class="img-rounded img-responsive bnExhibitionPictureImg" alt="未上传" style="max-height: 300px" src="${businessVo.business.bnExhibitionPicture}">
                                        </div>
                                        <div class="form-group">
                                            <label>营业执照</label>
                                            <input type="file" class="bnLicenseFile">
                                            <input type="hidden" name="bnLicense" class="bnLicense">
                                            <img class="img-rounded img-responsive bnLicenseImg" alt="未上传" style="max-height: 300px" src="${businessVo.business.bnLicense}">
                                        </div>
                                    </div>
                                    <!-- /.col-lg-6 (nested) -->
                                </div>
                                <!-- /.row (nested) -->

                                <button type="button" class="btn btn-primary" id="updateBusinessBtn">更 新</button>
                            </form>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
        </div>

        <%@include file="common/footer.jsp" %>

    </div>
    <!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->
</div>
<!-- /. WRAPPER  -->

<!-- JS Scripts-->
<%@include file="common/scripts.jsp" %>
<script>
    $(function() {
        // 设置选中下拉框
        var bnAuthorState = "${businessVo.business.bnAuthorState}";
        switch(parseInt(bnAuthorState)) {
            case 0:
                $(".bnAuthorState:eq(0)").attr("checked", "checked");
                break;
            case 1:
                $(".bnAuthorState:eq(1)").attr("checked", "checked");
                break;
            case 2:
                $(".bnAuthorState:eq(2)").attr("checked", "checked");
                break;
            default:
                alert("初始设置选中错误");
        }

        // 初始显示商家展示图
        var bnExhibitionPicture = "${businessVo.business.bnExhibitionPicture}";
        $(".bnExhibitionPicture").val(bnExhibitionPicture);
        var objbnExhibitionPictureList = bnExhibitionPicture.split("||");
        for (var i = 0; i < objbnExhibitionPictureList.length; i++) {
            $(".showbnExhibitionPicture").prepend('<img src="' + objbnExhibitionPictureList[i] + '" style="width: 300px; height: 190px; margin: 2px">');
        }

        // 初始显示营业执照
        var bnLicense = "${businessVo.business.bnLicense}";
        $(".bnLicense").val(bnLicense);
        var objbnLicenseList = bnLicense.split("||");
        for (var i = 0; i < objbnLicenseList.length; i++) {
            $(".showbnLicense").prepend('<img src="' + objbnLicenseList[i] + '" style="width: 300px; height: 190px; margin: 2px">');
        }
    });
</script>
</body>

</html>